﻿//==========================================================
//Đã sửa bởi tranninh_86_yb@yahoo.com ngày 20/06/2013
//==========================================================

using System;
using System.Data;
using System.Data.SqlClient;
using prjKQXS_DLL;

namespace prjKQXS_Report
{
    public partial class rptDMCanBo : DevExpress.XtraReports.UI.XtraReport
    {
        public rptDMCanBo(string ma_dv, bool onlyDLC1)
        {
            InitializeComponent();
            loadData(ma_dv, onlyDLC1);
        }

        private void loadData(string madv, bool onlyDLC1)
        {
            SqlConnection conn = new SqlConnection(BienTc.connString);
            SqlDataAdapter da = new SqlDataAdapter("proc_rptDMCanBo", conn);
            da.SelectCommand.CommandType = CommandType.StoredProcedure;

            if (onlyDLC1) da.SelectCommand.Parameters.AddWithValue("@OnlyDLC1", 1);
            else da.SelectCommand.Parameters.AddWithValue("@OnlyDLC1", 0);

            if (madv == "TC") da.SelectCommand.Parameters.AddWithValue("@MaDV", 'T');
            else da.SelectCommand.Parameters.AddWithValue("@MaDV", madv);

            da.Fill(dsReports1.rptDMCanBo);
        }

    }
}
